<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title><?php echo $title;?></title>
<link href="http://test.ben/tools/Static/css/link.css" rel="stylesheet" />
</head>
<body>
<form name="vote_form" method="post" action="">
<table>
	<tr>
		<td>标题：</td>
		<td><input type="text" name="vote_title" /></td>
	</tr>
	<tr>
		<td>简介：</td>
		<td><textarea name="vote_intro"></textarea></td>
	</tr>
	<tr>
		<td>分类：</td>
		<td>
			<select name="vote_type">
				<option value="1">单选</option>
				<option value="2">多选</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>状态：</td>
		<td>
			<input type="checkbox" name="vote_status" value="<?php echo $vote['status'];?>" />(选中则启用)
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="submit" value="提交" />
			<input type="hidden" value="1" name="dosubmit" />
		</td>
	</tr>
</table>
</form>

<?php
include 'app_functions.php';
if($_POST['dosubmit'] == 1){
	$main_id = (int)$_POST['id'];
	$main_title = trim($_POST['vote_title']);
	$main_intro = trim($_POST['vote_intro']);
	$main_creater = 'admin';
	$main_type = (int)$_POST['vote_type'];
	$main_status = (int)$_POST['vote_status'];
	$main_ctime = $main_utime = time();
	
	if($main_id){
		echo '--update--';

	}else{
		$sql = "INSERT INTO `plugin_vote_main` 
				(`main_title`,`main_intro`,`main_creater`,`main_type`,`main_ctime`,`main_utime`) VALUES 
				('{$main_title}','{$main_intro}','{$main_creater}','{$main_type}','{$main_ctime}','{$main_utime}')";
		$result = run_sql($sql);

		var_dump($sql,$result);
	}


	
}else{
	echo '---';
}
?>

</body>
</html>